﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Wp.DAL;
using Wp.BLL;

public partial class Controls_PostLastest : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadData();
        }
    }
    void LoadData()
    {
        int TotalRow = 0;
        int numberitemnew = Wp.BLL.TblOptionManager.CreateInstant().GetOption("number-items-new").Trim().ToInt();
        List<TblPostsEntity> ls = TblPostsManager.CreateInstant().SelectTblPostBy("post", "", -1, "", "category", "CreatedDate", "DESC", numberitemnew, 1, out TotalRow);
        rpt.DataSource = ls;
        rpt.DataBind();
        int numberitemhot = Wp.BLL.TblOptionManager.CreateInstant().GetOption("number-items-hot").Trim().ToInt();
        List<TblPostsEntity> ls1 = TblPostsManager.CreateInstant().SelectPopularTblPost(numberitemhot);
        rptView.DataSource = ls1;
        rptView.DataBind();
        int numberitemcommet = Wp.BLL.TblOptionManager.CreateInstant().GetOption("number-items-comment").Trim().ToInt();
        List<TblCommentsEntity> ls3 = TblCommentsManager.CreateInstant().SelectByPost(null, null, "approved", numberitemcommet);
        rptComment.DataSource = ls3;
        rptComment.DataBind();
    }
}